HAL ADC constant migration

This section provides information about the HAL ADC constant migration.

HAL ADC state constants

HAL1

HAL2

#define HAL_ADC_STATE_RESET     (0x00000000UL)
#define HAL_ADC_STATE_READY     (0x00000001UL)
#define HAL_ADC_STATE_REG_BUSY  (0x00000100UL)
#define HAL_ADC_STATE_AWD1      (0x00010000UL)
typedef enum
{
  HAL_ADC_STATE_RESET,
  HAL_ADC_STATE_INIT,
  HAL_ADC_STATE_CONFIGURING,
  HAL_ADC_STATE_IDLE,
  HAL_ADC_STATE_ACTIVE,
  HAL_ADC_STATE_CALIB,
} hal_adc_state_t;

typedef enum
{
  HAL_ADC_GROUP_STATE_RESET,
  HAL_ADC_GROUP_STATE_IDLE,
  HAL_ADC_GROUP_STATE_ACTIVE,
  HAL_ADC_GROUP_STATE_ACTIVE_SILENT,
} hal_adc_group_state_t;

typedef enum
{
  HAL_ADC_COMMON_STATE_RESET,
  HAL_ADC_COMMON_STATE_INDEPT,
  HAL_ADC_COMMON_STATE_LINKED,
  HAL_ADC_COMMON_STATE_MM,
} hal_adc_common_state_t;

Key changes

  • Conversion of constants to enumeration types: bitfield macros have been replaced with type-safe enumeration types.

  • Refactoring of the state machine: a single global state machine has been split into three distinct state machines:

    • Global state: hal_adc_state_t

    • Group state: hal_adc_group_state_t

    • Common state: hal_adc_common_state_t

Related concept:


HAL ADC error constants

HAL1

HAL2

#define HAL_ADC_ERROR_DMA
#define HAL_ADC_ERROR_OVR
#define HAL_ADC_ERROR_INTERNAL
#define HAL_ADC_ERROR_NONE

#define HAL_ADC_ERROR_INVALID_CALLBACK
#define HAL_ADC_REG_ERROR_DMA
#define HAL_ADC_REG_ERROR_OVR
#define HAL_ADC_ERROR_INTERNAL
#define HAL_ADC_ERROR_NONE

#define HAL_ADC_INJ_ERROR_CONTEXTS_OVF

Key changes

  • The define constant HAL_ADC_ERROR_INVALID_CALLBACK has been removed.

  • A new error constant related to the injected group context queue overflow has been added.

Related concept:


HAL ADC interruption constants

HAL1

HAL2



#define ADC_IT_AWD
#define ADC_IT_LDORDY
#define ADC_IT_EOCAL
#define ADC_IT_AWD3
#define ADC_IT_AWD2
#define ADC_IT_AWD1
#define ADC_IT_JEOS
#define ADC_IT_JEOC
#define ADC_IT_EOS

Removed; use the following define statement instead:

#define LL_ADC_IT_AWD
#define LL_ADC_IT_LDORDY
#define LL_ADC_IT_EOCAL
#define LL_ADC_IT_AWD3
#define LL_ADC_IT_AWD2
#define LL_ADC_IT_AWD1
#define LL_ADC_IT_JEOS
#define LL_ADC_IT_JEOC
#define LL_ADC_IT_EOS
#define LL_ADC_IT_EOS
#define LL_ADC_IT_EOS

Key changes

Related concept:

HAL ADC flag constants

HAL1

HAL2


#define ADC_FLAG_AWD
#define ADC_FLAG_LDORDY
#define ADC_FLAG_EOCAL
#define ADC_FLAG_AWD3
#define ADC_FLAG_AWD2
#define ADC_FLAG_AWD1
#define ADC_FLAG_JEOS
#define ADC_FLAG_JEOC
#define ADC_FLAG_EOS
...

Removed, use the following define statements instead :

#define LL_ADC_FLAG_AWD
#define LL_ADC_FLAG_LDORDY
#define LL_ADC_FLAG_EOCAL
#define LL_ADC_FLAG_AWD3
#define LL_ADC_FLAG_AWD2
#define LL_ADC_FLAG_AWD1
#define LL_ADC_FLAG_JEOS
#define LL_ADC_FLAG_JEOC
#define LL_ADC_FLAG_EOS

Key changes

  • The listed define statements in HAL1 are used by HAL ADC get flag and HAL ADC clear flag.

  • All ADC flag definitions have been removed from HAL2, use their equivalent LL services instead.

Related concept:


HAL ADC clock constants

HAL1

HAL2



#define ADC_CLOCK_SYNC_PCLK_DIV2
#define ADC_CLOCK_SYNC_PCLK_DIV4
#define ADC_CLOCK_SYNC_PCLK_DIV6
#define ADC_CLOCK_SYNC_PCLK_DIV8
typedef enum
{
  HAL_ADC_CLOCK_SYNC_DIV2,
  HAL_ADC_CLOCK_SYNC_DIV4,
  HAL_ADC_CLOCK_SYNC_DIV6,
  HAL_ADC_CLOCK_SYNC_DIV8
} hal_adc_clock_t;

Key changes

  • Conversion to enumerated type: the ADC resolution constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_CLOCK_SYNC_.

Related concept:


HAL ADC sequencer configuration constants

HAL1

HAL2



#define ADC_SCAN_SEQ_FIXED
#define ADC_SCAN_SEQ_FIXED_BACKWARD
#define ADC_SCAN_DIRECTION_FORWARD
#define ADC_SCAN_DIRECTION_BACKWARD
typedef enum
{
  HAL_ADC_REG_SEQ_FIXED,
  HAL_ADC_REG_SEQ_FIXED_BACKWARD,
  HAL_ADC_REG_SEQ_CONFIGURABLE
} hal_adc_reg_seq_mode_t;

Key changes

  • Conversion to enumerated type: the ADC sequencer configuration constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_REG_SEQ_.

Related concept:


HAL ADC sequencer rank constants

HAL1

HAL2


#define ADC_REGULAR_RANK_1
#define ADC_INJECTED_RANK_1

#define ADC_REGULAR_RANK_2
#define ADC_INJECTED_RANK_2

#define ADC_REGULAR_RANK_3
#define ADC_INJECTED_RANK_3

#define ADC_REGULAR_RANK_4
#define ADC_INJECTED_RANK_4
...
Use the following numerical values instead:
1


2


3


4
...

Key changes

  • Conversion to structure attribute: the ADC sequencer rank constants, which were previously defined using the #define constant, have been converted to a variable in the hal_adc_channel_config_t structure with the uint8_t type.

Related concept:


HAL ADC offset sign constants

HAL1

HAL2


#define ADC_OFFSET_SIGN_NEGATIVE
#define ADC_OFFSET_SIGN_POSITIVE
Removed; use the following define statements instead:
#define LL_ADC_OFFSET_SIGN_NEGATIVE
#define LL_ADC_OFFSET_SIGN_POSITIVE

HAL ADC resolution constants

HAL1

HAL2



#define ADC_RESOLUTION_6B
#define ADC_RESOLUTION_8B
#define ADC_RESOLUTION_10B
#define ADC_RESOLUTION_12B
typedef enum
{
  HAL_ADC_RESOLUTION_6_BIT,
  HAL_ADC_RESOLUTION_8_BIT,
  HAL_ADC_RESOLUTION_10_BIT,
  HAL_ADC_RESOLUTION_12_BIT
} hal_adc_resolution_t;

Key changes

  • Conversion to enumerated type: the ADC resolution constants, which were previously defined using #define macros, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_RESOLUTION_ and suffixed with the bit resolution.

Related concept:


HAL ADC data shift left constants

HAL1

HAL2



#define ADC_LEFTBITSHIFT_NONE
#define ADC_LEFTBITSHIFT_1
#define ADC_LEFTBITSHIFT_2
#define ADC_LEFTBITSHIFT_3
#define ADC_LEFTBITSHIFT_4
#define ADC_LEFTBITSHIFT_5
...
typedef enum
{
  HAL_ADC_LEFT_BIT_SHIFT_NONE,
  HAL_ADC_LEFT_BIT_SHIFT_1_BIT,
  HAL_ADC_LEFT_BIT_SHIFT_2_BITS,
  HAL_ADC_LEFT_BIT_SHIFT_3_BITS,
  HAL_ADC_LEFT_BIT_SHIFT_4_BITS,
  HAL_ADC_LEFT_BIT_SHIFT_5_BITS,
  ...
} hal_adc_left_bit_shift_t;

Key changes

  • Conversion to enumerated type: the ADC left bit shift constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_LEFT_BIT_SHIFT_ and suffixed with the bit shift value.

Related concept:


HAL ADC data shift right constants

HAL1

HAL2


#define ADC_RIGHTBITSHIFT_NONE
#define ADC_RIGHTBITSHIFT_1
#define ADC_RIGHTBITSHIFT_2
#define ADC_RIGHTBITSHIFT_3
#define ADC_RIGHTBITSHIFT_4
#define ADC_RIGHTBITSHIFT_5
...

Use the following numerical values instead:

0
1
2
3
4
5
...

Related concept:


HAL ADC indexes for linear and offset calibration constants

HAL1

HAL2


 #define ADC_CALIB_OFFSET_INDEX
 #define ADC_CALIB_LINEARITY_INDEX1
 #define ADC_CALIB_LINEARITY_INDEX2
 #define ADC_CALIB_LINEARITY_INDEX3
 #define ADC_CALIB_LINEARITY_INDEX4
 #define ADC_CALIB_LINEARITY_INDEX5
...

Use the following numerical values instead:

0
1
2
3
4
5
...

Related concept:


HAL ADC low-power feature auto-wait constants

HAL1

HAL2



#define ADC_AUTOWAIT_DISABLE
#define ADC_AUTOWAIT_ENABLE
typedef enum
{
  HAL_ADC_LP_AUTO_WAIT_DISABLE,
  HAL_ADC_LP_AUTO_WAIT_ENABLE
} hal_adc_lp_auto_wait_state_t;

Key changes

  • Conversion to enumerated type: the ADC auto-wait constants, which were previously defined using #define macros, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_LP_AUTO_WAIT_ and suffixed with the state (DISABLE or ENABLE).

Related concept:


HAL ADC multimode DMA transfer constants

HAL1

HAL2



#define ADC_DUALMODEDATAFORMAT_DISABLED
#define ADC_DUALMODEDATAFORMAT_32_10_BITS
#define ADC_DUALMODEDATAFORMAT_8_BITS
typedef enum
{
  HAL_ADC_MM_REG_DATA_EACH_ADC,
  HAL_ADC_MM_REG_DATA_PACK_32_BITS,
  HAL_ADC_MM_REG_DATA_PACK_16_BITS
} hal_adc_mm_reg_data_format_t;

Note

Renaming ADC_DUALMODEDATAFORMAT_8_BITS to HAL_ADC_MM_REG_DATA_PACK_16_BITS: as the system operates in dual ADC conversion mode and each ADC converts 8 bits, the overall conversion is on 16 bits.

Key changes

  • Conversion to enumerated type: the ADC auto-wait constants, which were previously defined using #define macros, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_MM_REG_DATA_.

Related concept:


HAL ADC trigger frequency mode constants

HAL1

HAL2



#define ADC_TRIGGER_FREQ_HIGH
#define ADC_TRIGGER_FREQ_LOW
typedef enum
{
  HAL_ADC_TRIGGER_FREQ_HIGH,
  HAL_ADC_TRIGGER_FREQ_LOW
} hal_adc_trigger_freq_mode_t;

Key changes

  • Conversion to enumerated type: the ADC trigger frequency mode constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_TRIGGER_FREQ_ and suffixed with (HIGH or LOW).

Related concept:


HAL ADC oversampling ratio constants

HAL1

HAL2


#define ADC_OVERSAMPLING_RATIO_2
#define ADC_OVERSAMPLING_RATIO_4
#define ADC_OVERSAMPLING_RATIO_8
...

Use the following numerical values instead:

2
4
8
...

Related concept:


HAL ADC sampling mode constants

HAL1

HAL2



#define ADC_SAMPLING_MODE_NORMAL
#define ADC_SAMPLING_MODE_BULB
#define ADC_SAMPLING_MODE_TRIGGER_CONTROLED
typedef enum
{
  HAL_ADC_SAMPLING_MODE_NORMAL,
  HAL_ADC_SAMPLING_MODE_BULB,
  HAL_ADC_SAMPLING_MODE_TRIGGER_CTRL
} hal_adc_sampling_mode_t;

Key changes

  • Conversion to enumerated type: the ADC sampling mode constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the ADC_SAMPLING_MODE_TRIGGER_CONTROLED constant has been renamed to HAL_ADC_SAMPLING_MODE_TRIGGER_CTRL for better readability and consistency.

Related concept:


HAL ADC group constants

HAL1

HAL2



#define ADC_REGULAR_GROUP
#define ADC_INJECTED_GROUP
#define ADC_REGULAR_INJECTED_GROUP
typedef enum
{
  HAL_ADC_GROUP_REGULAR,
  HAL_ADC_GROUP_INJECTED,
  HAL_ADC_GROUP_REGULAR_INJECTED,
  HAL_ADC_GROUP_NONE
} hal_adc_group_t;

Key changes

  • Conversion to enumerated type: the ADC group constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_GROUP_.

Related concept:


HAL ADC regular group conversion trigger source constants

HAL1

HAL2



#define ADC_EXTERNALTRIGCONV_Ext_IT11
#define ADC_EXTERNALTRIGCONV_T1_CC1
#define ADC_EXTERNALTRIGCONV_T1_CC2
#define ADC_EXTERNALTRIGCONV_T1_CC3
#define ADC_EXTERNALTRIGCONV_T1_TRGO
...
 typedef enum
{
  HAL_ADC_REG_TRIG_EXTI11,
  HAL_ADC_REG_TRIG_TIM1_CH1,
  HAL_ADC_REG_TRIG_TIM1_CH2,
  HAL_ADC_REG_TRIG_TIM1_CH3,
  HAL_ADC_REG_TRIG_TIM1_TRGO
  ...
} hal_adc_reg_trig_src_t;

Key changes

  • Conversion to enumerated type: the ADC external trigger conversion constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_REG_TRIG_.

Related concept:


HAL ADC regular group conversion trigger edge constants

HAL1

HAL2



#define ADC_EXTERNALTRIGCONVEDGE_NONE
#define ADC_EXTERNALTRIGCONVEDGE_RISING
#define ADC_EXTERNALTRIGCONVEDGE_FALLING
#define ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING
typedef enum
{
  HAL_ADC_REG_TRIG_EDGE_NONE,
  HAL_ADC_REG_TRIG_EDGE_RISING,
  HAL_ADC_REG_TRIG_EDGE_FALLING,
  HAL_ADC_REG_TRIG_EDGE_RISING_FALLING
} hal_adc_reg_trig_edge_t;

Key changes

  • Conversion to enumerated type: the ADC external trigger edge constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_REG_TRIG_EDGE_.

Related concept:


HAL ADC regular group overrun mode constants

HAL1

HAL2



#define ADC_OVR_DATA_PRESERVED
#define ADC_OVR_DATA_OVERWRITTEN
typedef enum
{
  HAL_ADC_REG_OVR_DATA_PRESERVED,
  HAL_ADC_REG_OVR_DATA_OVERWRITTEN
} hal_adc_reg_overrun_mode_t;

Key changes

  • Conversion to enumerated type: the previous #define constants for ADC overrun data handling have been replaced with an enum type named hal_adc_reg_overrun_mode_t.

  • Renamed constants: ADC_OVR_DATA_PRESERVED to HAL_ADC_REG_OVR_DATA_PRESERVED ADC_OVR_DATA_OVERWRITTEN to HAL_ADC_REG_OVR_DATA_OVERWRITTEN

Related concept:


HAL ADC regular group data transfer constants

HAL1

HAL2



#define ADC_CONVERSIONDATA_DR
#define ADC_OVR_DATA_OVERWRITTEN
typedef enum
{
  HAL_ADC_REG_DATA_TRANSFER_NONE,
  HAL_ADC_REG_DATA_TRANSFER_MDF
} hal_adc_reg_data_transfer_mode_t;

Key changes

  • Conversion to enumerated type: the ADC conversion data handling constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_REG_DATA_TRANSFER_.

Related concept:


HAL ADC low-power and deep power-down selection constants

HAL1

HAL2



#define ADC_LOW_POWER_NONE
#define ADC_LOW_POWER_AUTOFF
#define ADC_LOW_POWER_DPD
#define ADC_LOW_POWER_AUTOFF_DPD
typedef enum
{
  HAL_ADC_LP_AUTO_POWER_OFF_DISABLE,
  HAL_ADC_LP_AUTO_POWER_OFF_ENABLE
} hal_adc_lp_auto_power_off_state_t;

typedef enum
{
  HAL_ADC_LP_AUTONOMOUS_DPD_DISABLE,
  HAL_ADC_LP_AUTONOMOUS_DPD_ENABLE
} hal_adc_lp_autonomous_dpd_state_t;

Key changes

  • Conversion to enumerated type: the ADC low-power and deep power-down selection constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_LP_AUTO_POWER_ or HAL_ADC_LP_AUTONOMOUS_DPD_.

Related concept:


HAL ADC injected group conversion trigger source constants

HAL1

HAL2



#define ADC_EXTERNALTRIGINJECCONV_T1_CC4
#define ADC_EXTERNALTRIGINJECCONV_T1_TRGO
#define ADC_EXTERNALTRIGINJECCONV_T2_TRGO
#define ADC_EXTERNALTRIGINJECCONV_T3_CC2
...
typedef enum
{
  HAL_ADC_INJ_TRIG_TIM1_CH4,
  HAL_ADC_INJ_TRIG_TIM1_TRGO,
  HAL_ADC_INJ_TRIG_TIM2_TRGO,
  HAL_ADC_INJ_TRIG_TIM3_CH2,
  ...
  HAL_ADC_INJ_TRIG_FROM_GRP_REGULAR
} hal_adc_inj_trig_src_t;

Key changes

  • Conversion to enumerated type: the previous #define constant for ADC external trigger injection conversions has been replaced with an enum type named hal_adc_inj_trig_src_t.

  • Renamed constants: ADC_EXTERNALTRIGINJECCONV_Tx_CCy to HAL_ADC_INJ_TRIG_TIMx_CHy ADC_EXTERNALTRIGINJECCONV_Tx_TRGO to HAL_ADC_INJ_TRIG_TIMx_TRGO

Related concept:


HAL ADC injected group conversion trigger edge constants

HAL1

HAL2



#define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE
#define ADC_EXTERNALTRIGINJECCONV_EDGE_RISING
#define ADC_EXTERNALTRIGINJECCONV_EDGE_FALLING
#define ADC_EXTERNALTRIGINJECCONV_EDGE_RISINGFALLING
typedef enum
{
  HAL_ADC_INJ_TRIG_EDGE_NONE,
  HAL_ADC_INJ_TRIG_EDGE_RISING,
  HAL_ADC_INJ_TRIG_EDGE_FALLING,
  HAL_ADC_INJ_TRIG_EDGE_RISING_FALLING
} hal_adc_inj_trig_edge_t;

Key changes

  • Conversion to enumerated type: the ADC external trigger injection edge constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_INJ_TRIG_EDGE_.

Related concept:


HAL ADC channel constants

HAL1

HAL2



#define ADC_CHANNEL_0
#define ADC_CHANNEL_1
#define ADC_CHANNEL_2
#define ADC_CHANNEL_3
#define ADC_CHANNEL_4
#define ADC_CHANNEL_5
#define ADC_CHANNEL_6
#define ADC_CHANNEL_7
#define ADC_CHANNEL_8
#define ADC_CHANNEL_9
#define ADC_CHANNEL_10
#define ADC_CHANNEL_11
#define ADC_CHANNEL_12
#define ADC_CHANNEL_13
#define ADC_CHANNEL_VREFINT
#define ADC_CHANNEL_TEMPSENSOR
typedef enum
{
  HAL_ADC_CHANNEL_0,
  HAL_ADC_CHANNEL_1,
  HAL_ADC_CHANNEL_2,
  HAL_ADC_CHANNEL_3,
  HAL_ADC_CHANNEL_4,
  HAL_ADC_CHANNEL_5,
  HAL_ADC_CHANNEL_6,
  HAL_ADC_CHANNEL_7,
  HAL_ADC_CHANNEL_8,
  HAL_ADC_CHANNEL_9,
  HAL_ADC_CHANNEL_10,
  HAL_ADC_CHANNEL_11,
  HAL_ADC_CHANNEL_12,
  HAL_ADC_CHANNEL_13,
  HAL_ADC_CHANNEL_VREFINT,
  HAL_ADC_CHANNEL_TEMPSENSOR,
  HAL_ADC_CHANNEL_NONE,
  HAL_ADC_CHANNEL_ALL
} hal_adc_channel_t;

Key changes

  • Conversion to enumerated type: the previous #define constant for ADC channels has been replaced with an enum type named hal_adc_channel_t.

  • Renamed constants: ADC_CHANNEL_x to HAL_ADC_CHANNEL_x.

Related concept:


HAL ADC (channel-wise) sampling time constants

HAL1

HAL2



#define ADC_SAMPLETIME_2CYCLES_5
#define ADC_SAMPLETIME_6CYCLES_5
...
typedef enum
{
  ...
  HAL_ADC_SAMPLING_TIME_8CYCLES  ,
  HAL_ADC_SAMPLING_TIME_13CYCLES  ,
  HAL_ADC_SAMPLING_TIME_25CYCLES  ,
  HAL_ADC_SAMPLING_TIME_48CYCLES  ,
  HAL_ADC_SAMPLING_TIME_139CYCLES  ,
  HAL_ADC_SAMPLING_TIME_289CYCLES  ,
  ...

} hal_adc_sampling_time_t;

Key changes

  • Conversion to enumerated type: the ADC sample time constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_SAMPLETIME_.

Related concept:


HAL ADC channel ending constants (single- or differential-ended)

HAL1

HAL2



#define ADC_SINGLE_ENDED
#define ADC_DIFFERENTIAL_ENDED
typedef enum
{
  HAL_ADC_IN_SINGLE_ENDED,
  HAL_ADC_IN_DIFFERENTIAL
} hal_adc_in_mode_t;

Key changes

  • Conversion to enumerated type: the ADC channel ended mode constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_CHANNEL_.

Related concept:


HAL ADC analog watchdog instance constants

HAL1

HAL2



#define ADC_ANALOGWATCHDOG_1
#define ADC_ANALOGWATCHDOG_2
#define ADC_ANALOGWATCHDOG_3
typedef enum
{
  HAL_ADC_AWD_1,
  HAL_ADC_AWD_2,
  HAL_ADC_AWD_3
} hal_adc_awd_instance_t;

Key changes

  • Conversion to enumerated type: the ADC analog watchdog instance constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_AWD_.

Related concept:


HAL ADC analog watchdog filtering constants

HAL1

HAL2



#define ADC_AWD_FILTERING_NONE
#define ADC_AWD_FILTERING_2SAMPLES
#define ADC_AWD_FILTERING_3SAMPLES
#define ADC_AWD_FILTERING_4SAMPLES
#define ADC_AWD_FILTERING_5SAMPLES
#define ADC_AWD_FILTERING_6SAMPLES
#define ADC_AWD_FILTERING_7SAMPLES
#define ADC_AWD_FILTERING_8SAMPLES
typedef enum
{
  HAL_ADC_AWD_FILTERING_NONE,
  HAL_ADC_AWD_FILTERING_2SAMPLES,
  HAL_ADC_AWD_FILTERING_3SAMPLES,
  HAL_ADC_AWD_FILTERING_4SAMPLES,
  HAL_ADC_AWD_FILTERING_5SAMPLES,
  HAL_ADC_AWD_FILTERING_6SAMPLES,
  HAL_ADC_AWD_FILTERING_7SAMPLES,
  HAL_ADC_AWD_FILTERING_8SAMPLES
} hal_adc_awd_filtering_t;

Key changes

  • Conversion to enumerated type: the ADC analog watchdog filtering constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_AWD_FILTERING_.

Related concept:


HAL ADC oversampling scope constants

HAL1

HAL2



#define ADC_REGOVERSAMPLING_CONTINUED_MODE
#define ADC_REGOVERSAMPLING_RESUMED_MODE
...
typedef enum
{
  HAL_ADC_OVS_REG_CONTINUED,
  HAL_ADC_OVS_REG_RESUMED
  ...

} hal_adc_ovs_scope_t;

Key changes

  • Conversion to enumerated type: the ADC regular oversampling mode constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_OVS_GRP_REGULAR_.

Related concept:


HAL ADC oversampling discontinuous mode constants

HAL1

HAL2



#define ADC_TRIGGEREDMODE_SINGLE_TRIGGER
#define ADC_TRIGGEREDMODE_MULTI_TRIGGER
...
typedef enum
{
  HAL_ADC_OVS_CONT,
  HAL_ADC_OVS_DISCONT
} hal_adc_ovs_discont_t;

Key changes

  • Conversion to enumerated type: the ADC triggered-mode constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_OVS_REG_.

Related concept:


HAL ADC offset constants

HAL1

HAL2

#define ADC_OFFSET_NONE

#define ADC_OFFSET_1
#define ADC_OFFSET_2
#define ADC_OFFSET_3
#define ADC_OFFSET_4
typedef enum
{
  HAL_ADC_OFFSET_1,
  HAL_ADC_OFFSET_2,
  HAL_ADC_OFFSET_3,
  HAL_ADC_OFFSET_4
} hal_adc_offset_instance_t;

Key changes

  • Conversion to enumerated type: the ADC offset constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_OFFSET_.

Related concept:


HAL VREF+ protection mode selection constants

HAL1

HAL2



#define ADC_VREF_PPROT_NONE
#define ADC_VREF_PPROT_VREFPROT
#define ADC_VREF_PPROT_VREFSECSMP
#define ADC_VREF_PPROT_VREF_VREFSECSMP
typedef enum
{
  HAL_ADC_VREF_PROT_DISABLE,
  HAL_ADC_VREF_PROT_FIRST_SAMP_ENABLE,
  HAL_ADC_VREF_PROT_SECOND_SAMP_ENABLE
} hal_adc_vref_protection_t;

Key changes

  • Conversion to enumerated type: the ADC offset constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_VREF_PROT_.

Related concept:


HAL ADC multimode mode constants

HAL1

HAL2



#define ADC_MODE_INDEPENDENT
#define ADC_DUALMODE_REGSIMULT
#define ADC_DUALMODE_INTERL
#define ADC_DUALMODE_INJECSIMULT
#define ADC_DUALMODE_ALTERTRIG
#define ADC_DUALMODE_REGSIMULT_INJECSIMULT
#define ADC_DUALMODE_REGSIMULT_ALTERTRIG
#define ADC_DUALMODE_REGINTERL_INJECSIMULT
typedef enum
{
  HAL_ADC_MM_INDEPENDENT,
  HAL_ADC_MM_DUAL_REG_SIMULT,
  HAL_ADC_MM_DUAL_REG_INTERL,
  HAL_ADC_MM_DUAL_INJ_SIMULT,
  HAL_ADC_MM_DUAL_INJ_ALTERN,
  HAL_ADC_MM_DUAL_REG_SIM_INJ_SIM,
  HAL_ADC_MM_DUAL_REG_SIM_INJ_ALT,
  HAL_ADC_MM_DUAL_REG_INT_INJ_SIM
} hal_adc_mm_mode_t;

Key changes

  • Conversion to enumerated type: the ADC multi-mode constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_MM_.

Related concept:


HAL ADC delay between two sampling phases constants

HAL1

HAL2



#define ADC_TWOSAMPLINGDELAY_1CYCLE
#define ADC_TWOSAMPLINGDELAY_2CYCLES
#define ADC_TWOSAMPLINGDELAY_3CYCLES
#define ADC_TWOSAMPLINGDELAY_4CYCLES
#define ADC_TWOSAMPLINGDELAY_5CYCLES
#define ADC_TWOSAMPLINGDELAY_6CYCLES
...
typedef enum
{
  HAL_ADC_MM_INTERL_DELAY_1CYCLE,
  HAL_ADC_MM_INTERL_DELAY_2CYCLES,
  HAL_ADC_MM_INTERL_DELAY_3CYCLES,
  HAL_ADC_MM_INTERL_DELAY_4CYCLES,
  HAL_ADC_MM_INTERL_DELAY_5CYCLES,
  HAL_ADC_MM_INTERL_DELAY_6CYCLES,
  ...
} hal_adc_mm_interl_delay_t;

Key changes

  • Conversion to enumerated type: the ADC two-sampling delay constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_MM_INTERL_DELAY_.

Related concept:


HAL ADC event constants

HAL1

HAL2



#define ADC_EOSMP_EVENT
#define ADC_AWD1_EVENT
#define ADC_AWD2_EVENT
#define ADC_AWD3_EVENT
#define ADC_OVR_EVENT
#define ADC_EOC_EVENT
#define ADC_EOS_EVENT
#define ADC_JEOC_EVENT
#define ADC_JEOS_EVENT
typedef enum
{
  HAL_ADC_EVENT_EOSMP,
  HAL_ADC_EVENT_AWD_1,
  HAL_ADC_EVENT_AWD_2,
  HAL_ADC_EVENT_AWD_3,
  HAL_ADC_EVENT_OVR,
  HAL_ADC_EVENT_EOC,
  HAL_ADC_EVENT_EOS,
  HAL_ADC_EVENT_JEOC,
  HAL_ADC_EVENT_JEOS

} hal_adc_event_t;

Key changes

  • Conversion to enumerated type: the ADC event constants, which were previously defined using the #define constant, have been converted to an enumerated type (enum).

  • Renaming for consistency: the constants have been renamed to follow a consistent naming convention, prefixed with HAL_ADC_EVENT_.

Related concept:


HAL ADC analog watchdog mode constants

HAL1

HAL2

#define ADC_ANALOGWATCHDOG_ALL_REGINJEC


#define ADC_ANALOGWATCHDOG_ALL_INJEC


#define ADC_ANALOGWATCHDOG_ALL_REG


#define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC


#define ADC_ANALOGWATCHDOG_SINGLE_INJEC


#define ADC_ANALOGWATCHDOG_SINGLE_REG


#define ADC_ANALOGWATCHDOG_NONE
#define HAL_ADC_GROUP_REGULAR_INJECTED
#define HAL_ADC_CHANNEL_ALL

#define HAL_ADC_GROUP_INJECTED
#define HAL_ADC_CHANNEL_ALL

#define HAL_ADC_GROUP_REGULAR
#define HAL_ADC_CHANNEL_ALL

#define HAL_ADC_GROUP_REGULAR_INJECTED
#define HAL_ADC_CHANNEL_xx

#define HAL_ADC_GROUP_INJECTED
#define HAL_ADC_CHANNEL_xx

#define ADC_ANALOGWATCHDOG_SINGLE_REG
#define HAL_ADC_CHANNEL_xx

#define HAL_ADC_GROUP_NONE
#define HAL_ADC_CHANNEL_NONE
Case 1:

AnalogWDGConfig.WatchdogMode = ADC_ANALOGWATCHDOG_ALL_REG;

Case 2:

AnalogWDGConfig.WatchdogMode = ADC_ANALOGWATCHDOG_SINGLE_REGINJEC;

Example :
AnalogWDGConfig.WatchdogNumber = ADC_ANALOGWATCHDOG_1;
AnalogWDGConfig.WatchdogMode = ADC_ANALOGWATCHDOG_ALL_REG;
AnalogWDGConfig.ITMode = ENABLE;
AnalogWDGConfig.HighThreshold = ADC_AWD_THRESHOLD_HIGH;
AnalogWDGConfig.LowThreshold = ADC_AWD_THRESHOLD_LOW;
AnalogWDGConfig.FilteringConfig = ADC_AWD_FILTERING_NONE;
HAL_ADC_AnalogWDGConfig(&hadc1, &AnalogWDGConfig);
Case 1:

adc_awd_config.group = HAL_ADC_GROUP_REGULAR;

adc_awd_config.channel = HAL_ADC_CHANNEL_ALL;

Case 2:

adc_awd_config.group = HAL_ADC_GROUP_REGULAR_INJECTED;

adc_awd_config.channel = HAL_ADC_CHANNEL_8;

Example :
adc_awd_config.group           = HAL_ADC_GROUP_REGULAR;
adc_awd_config.channel         = HAL_ADC_CHANNEL_8;
adc_awd_config.threshold_high  = 0x7FF;
adc_awd_config.threshold_low   = 0;
adc_awd_config.filtering       = HAL_ADC_AWD_FILTERING_NONE;
HAL_ADC_SetConfigAnalogWD(&hADC, HAL_ADC_AWD_1, &adc_awd_config);

Related concept:


HAL ADC dma transfer mode constants

HAL1

HAL2

#define ADC_CONVERSIONDATA_DMA_CIRCULAR
#define ADC_CONVERSIONDATA_DMA_ONESHOT

Removed; the DMA transfer mode is now controlled by the hal_dma_xfer_mode_t enumeration, which is used when configuring the DMA for ADC conversions.

Related concept:


HAL ADC field constants

HAL1

HAL2

#define ADC_CFGR_FIELDS
#define ADC_SMPR1_FIELDS
#define ADC4_CFGR_FIELDS_2
#define ADC_CFGR_FIELDS_2
#define ADC_CHSELR_SQ2_TO_SQ8
#define ADC4_SCAN_SEQ_FIXED_INT
#define ADC_LINEARITY_BIT_TOGGLE_TIMEOUT

Removed; used only by the internal implementation (not impacting the user).

Related concept: